using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class LoginPanel : BasePanel
{
    protected override void Awake()
    {
        //必须调用
        base.Awake();
    }

    void Start()
    {
        Debug.LogFormat("[Lesson10][Start]");
        GetControl<Text>("title").text = "登录面板";

        UIMgr.AddCustomEventListener(GetControl<Button>("btnLogin"), EventTriggerType.PointerEnter, (data) =>
        {
            Debug.LogFormat("[Lesson10][Start] btnLogin PointerEnter");
        });
        UIMgr.AddCustomEventListener(GetControl<Button>("btnLogin"), EventTriggerType.PointerExit, (data) =>
        {
            Debug.LogFormat("[Lesson10][Start] btnLogin PointerExit");
        });
    }
    public void InitInfo()
    {
        Debug.LogFormat("[LoginPanel][InitInfo]");
    }

    //按钮响应
    protected override void OnClick(string btnName)
    {
        switch (btnName)
        {
            case "btnLogin":
                Debug.LogFormat("登录");
                break;
            case "btnSetting":
                Debug.LogFormat("设置");
                break;
            case "btnCancel":
                UIMgr.GetInstance().HidePanel<LoginPanel>();
                Debug.LogFormat("取消");
                break;
        }
    }
}
